package org.example.finalsecurities.task;

import lombok.extern.slf4j.Slf4j;
import org.example.finalsecurities.service.AlertService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 爬取证券快讯任务
 *
 * @author : [CaiJianbin]
 * @version : [v1.0]
 */
@Component
@Slf4j
public class CrawlStockAlertJob implements Job {
    @Autowired
    private AlertService alertService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        alertService.delete();
        alertService.fetchAndUpdateAlert();
        log.info("成功爬取证券快讯");
    }
}
